﻿using DataProcess.Interface;
using DataProcess.Interface.Models;
using Newtonsoft.Json;
using System.Collections.Generic;

namespace DataProcessing.DBCalorimeter
{
    public class DataProcessing : IDataProcessing
    {
        public string Name { get { return "量热仪_Access"; } }

        public IDataOutput Processing(string content)
        {
            if (string.IsNullOrEmpty(content)) return null;
            DataBaseOutputModel outputModel = new DataBaseOutputModel()
            {
                InstrumentType = InstrumentType.Calorimetry,
            };
            try
            {
                var rows = JsonConvert.DeserializeObject<List<Dictionary<string, string>>>(content);
                if (rows != null)
                {
                    outputModel.Rows.AddRange(rows);
                }
            }
            catch
            {
            }
            return outputModel;
        }
    }
}
